<%@ page language="java" contentType="text/html;charset=UTF-8" errorPage="/error.jsp"%>
<%@ taglib uri="/tld/extremecomponents" prefix="ec" %>
<%@ include file="../../common/common.jsp" %>	
<%@ include file="master_pass.jsp" %>
<% 	
masterLogin.hasPermission(3001);
//权限判断代码结束
Integer parentId = Utility.parseInt(request.getParameter("parentId"));

IClassService classService = (IClassService)BeanManager.getBean("classService");
classService.AutoBindingTable(request);
%>
<html>
<head>
<title><%=SYSTITLE%> - 社区分类/版面管理</title>
<%@ include file="../../common/meta.inc" %>
<link href="css.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/extremetable/extremecomponents.css"/>
<SCRIPT LANGUAGE="javascript" SRC="${pageContext.request.contextPath}/scripts/common-validator.js"></SCRIPT>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/prototype.js"></script>
<script language="javascript" src="${pageContext.request.contextPath}/scripts/buffalo/buffalo.js"></script>
<script language="javascript">
var END_POINT="${pageContext.request.contextPath}/buffalo";
var buffalo = new Buffalo(END_POINT);

function newInfo()
{
	location.href="class_new.jsp";
}

function updateInfo(id)
{
	location.href="class_update.jsp?classId="+id;
}


function deleteInfo(id,type)
{
	if(!sl_confirm('删除选定的记录')) return false;
	
	if(type==0)	//分类
	{	
		if(!sl_continue("删除分类将同时删除其子分类/版面"))
			return;	
	}
	if(!sl_continue("删除后的数据将不能恢复"))
			return;		
	var obj = parseInt(id);
	buffalo.remoteCall("classServiceAjaxService.delete",[obj], function(reply) {
        ajaxSubmit(reply.getResult(),"删除成功！","reload");
    });
	
}

function buildMenu()
{
	buffalo.remoteCall("classServiceAjaxService.createClassFiles",[], function(reply) {
        ajaxSubmit(reply.getResult(),"操作成功！");
    });
}
</script>
</head>
<body leftMargin=5 topMargin=10 rightmargin="0" bottommargin="0" >
<table width="99%" border="0" align="center" cellpadding="2" cellspacing="2" bgcolor="#e6e6e6">
  <tr>
    <td align="center"><strong>配置社区分类/版面</strong></td>
  </tr>
</table>
	<ec:table 
		items="resultList"
		var="rs"	
		retrieveRowsCallback="limit"
        sortRowsCallback="limit"			
		action="${pageContext.request.contextPath}/club/admin/class.jsp"		
		title="社区分类/版面"
		>	
		<ec:parameter name="parentId" value="<%=parentId %>"/>	
		<ec:row>
				<ec:column property="CLASS_ID" title="序号" >
					<input type="checkbox" name="areaId" value="${rs.CLASS_ID}">${rs.CLASS_ID}
				</ec:column>
				<ec:column property="CLASS_NAME" title="名称" >
					<a href="class.jsp?parentId=${rs.CLASS_ID}" title="打开子分类/版面"><span style="color:blue">${rs.CLASS_NAME}</span></a>
				</ec:column>
				<ec:column property="CLASS_TYPE" title="类别"  cell="dictParamCell" parse="S003"/>
				<ec:column property="HIDDEN_FLAG" title="是否隐藏"/>
				<ec:column property="CLASS_PRO" title="属性"  cell="dictParamCell" parse="S007"/>
				<ec:column property="CLASS_STYLE" title="默认风格"  cell="dictParamCell" parse="S004"/>				
				<ec:column property="TOTAL_TOPIC" title="总主题数"/>
				<ec:column property="TOTAL_REPLY" title="总回复数"/>
				<ec:column property="1" title="操作" width="15%" sortable="false" viewsAllowed="html">
					<input type="button" name="btnEdit" value="编辑" onclick="javascript:updateInfo(${rs.CLASS_ID})">
					&nbsp;&nbsp;
					<input type="button" name="btnEdit" value="删除" onclick="javascript:deleteInfo(${rs.CLASS_ID},${rs.CLASS_TYPE})">
				</ec:column>
		</ec:row>
	</ec:table>
			<table border="0" width="100%">
				<tr valign="top">
					<td align="right">
					<%if(parentId.intValue()>0) {%>
					<button class="btn" accessKey=b id="btnBack" name="btnBack" title="返回上一层" onclick="javascript:history.back();">返回上一层(<u>B</u>)</button>
					&nbsp;&nbsp;&nbsp;
					<%} %>
					<button class="btn" id="btnBuildMenu" name="btnBuildMenu" title="重新生成左栏菜单" onclick="javascript:buildMenu();">重新生成左栏菜单</button>
					&nbsp;&nbsp;&nbsp; 
					<button class="btn" accessKey=n id="btnNew" name="btnNew" title="新建记录" onclick="javascript:newInfo();">新建(<u>N</u>)</button>
					&nbsp;&nbsp;&nbsp; 
					<button class="btn" accessKey=r id="btnRefresh" name="btnRefresh" title="刷新当前页面" onclick="javascript:location.reload();this.disabled=true;">刷新(<u>R</u>)</button>
					&nbsp;&nbsp;&nbsp;<td>
				</tr>
			</table>	
</body>
</html>
